package com.wenruo.funycollecte.util;

import android.content.Context;
import android.content.SharedPreferences;

public class ContextUtil {
	
	public static Context context;
	public static SharedPreferences sharedPreferences;
	public static SharedPreferences.Editor editor;
	
	public static void init(Context cxt) {
		context = cxt;
		sharedPreferences = cxt.getSharedPreferences("duoshuo", Context.MODE_PRIVATE);
		editor = sharedPreferences.edit();
	}
	
	public static String getString(String name, String defaultValue) {
		return sharedPreferences.getString(name, defaultValue);
	}
	
	public static boolean getBoolean(String name, boolean defaultValue) {
		return sharedPreferences.getBoolean(name, defaultValue);
	}
	
	public static void putString(String name, String value) {
		editor.putString(name, value);
		editor.commit();
	}
	
	public static void putBoolean(String name, boolean value) {
		editor.putBoolean(name, value);
		editor.commit();
	}
	
	public static void putLong(String name, long value) {
		editor.putLong(name, value);
		editor.commit();
	}
	
	public static Context getApplicationContext() {
		return context;
	}
	
}
